package com.effective;

import java.util.HashSet;
import java.util.Set;

public class TypeInference {
	public static Set<Number> union(Set<? extends Number> s1, Set<? extends Number> s2) {
		Set<Number> s = new HashSet<>();
		s.addAll(s1);
		s.addAll(s2);
		return s;
	}
	
	public static void main(String[] args) {
		Set<Double> s1 = new HashSet<>();
		Set<Integer> s2 = new HashSet<>();
		Set<Number> union = TypeInference.<Number>union(s1, s2);
		System.out.println(union);
	}
}
